﻿using LJX.SmartPark.Common.Const;

namespace LJX.SmartPark.WebApi.Extensions
{
    public static class CorsServiceRegister
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceCollection"></param>
        /// <returns></returns>
        public static IServiceCollection CorsRegister(this IServiceCollection serviceCollection)
        {
            serviceCollection.AddCors(op =>
            {
                op.AddPolicy(AssemblyConst.CORS_POLICY, policy =>
                {
                    policy.AllowAnyHeader()
                    .AllowAnyOrigin()
                    .AllowAnyMethod();
                });
            });

            return serviceCollection;
        }
    }
}
